#! /bin/sh
. ./common.sh

if ! command -v git >/dev/null 2>&1; then
    info "not installed git, will install it now!"
    si git
fi

info "start git settings"

info "step 1: setup ssh key"
rm -rf ~/.ssh
rm -rf ~/git_settings
git clone https://gitee.com/lgf1244/git_settings.git ~/git_settings
chmod 600 ~/git_settings/.ssh/*_id_rsa
chmod 600 ~/git_settings/.ssh/config
cp -rp ~/git_settings/.ssh ~
rm -rf rp ~/git_settings

info "test ssh key"
ssh -T git@gitee.com
